<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html" ; charset="utf-8" />
    <title>学生信息查询</title>
    <link href="../../../css/main.css" rel="stylesheet" type="text/css" />
    <link
      href="../../../bstable/css/bootstrap.min.css"
      rel="stylesheet"
      type="text/css"
    />
    <link
      href="../../../bstable/css/bootstrap-table.css"
      rel="stylesheet"
      type="text/css"
    />
  </head>

  <body>
    <div class="tabe_div">
      <p
        class="p_line text_ient"
        style="margin-bottom: -10px; border-bottom: 0"
      >
        <a class="find_a">报考类型：</a>
        <select class="form_select" style="padding-left: 1%" id="type">
          <option value="">全部</option>
          <option value="education">学历提升</option>
          <option value="occupation">职业技能</option>
          <option value="title">职称评审</option>
          <option value="train">执业资格</option>
        </select>
        <a class="find_a">审核状态：</a>
        <select class="form_select" style="padding-left: 1%" id="status">
          <option value="">全部</option>
          <option value="0">已保存</option>
          <option value="1">已提交</option>
          <option value="2">待财务审核</option>
          <option value="3">财务驳回</option>
          <option value="4">待教务审核</option>
          <option value="5">教务驳回</option>
          <option value="6">教务确认</option>
          <option value="8">已退款</option>
          <option value="10">财务确认</option>
        </select>
        <a class="find_a">学生姓名：</a>
        <input
          type="text"
          id="name"
          class="form_input text_ient"
          placeholder="输入学生姓名"
        />
        <!-- <a class="find_a">学生手机号：</a>
            <input type="number" id="phone" class="form_input text_ient" placeholder="输入学生手机号" maxlength="11" /> -->
      </p>
      <p class="p_line text_ient" style="margin-bottom: -10px">
        <a class="find_a">学生身份证号：</a>
        <input
          type="text"
          id="card"
          class="form_input text_ient"
          placeholder="输入身份证号"
          maxlength="18"
        />
        <a class="find_a">业务进度：</a>
        <select
          class="form_select"
          style="padding-left: 1%"
          id="businessProgress"
        >
          <option value="">全部</option>
          <option value="0">报考</option>
          <option value="1">退款</option>
          <option value="2">分期缴费</option>
        </select>
        <input type="button" value="查询" class="but_find" id="search" />
      </p>
      <table
        data-url="json/data_alae_list.json"
        id="table"
        class="table_style"
        style="margin: 20px auto"
      ></table>
    </div>
    <script src="../../../js/jquery.js"></script>
    <script src="../../../js/common.js"></script>
    <script src="../../../js/laydate-master/laydate.js"></script>
    <script src="../../../bstable/js/bootstrap.min.js"></script>
    <script src="../../../bstable/js/bootstrap-table.js"></script>
    <script src="../../../bstable/js/bootstrap-table-zh-CN.min.js"></script>
    <script type="text/javascript">
      localStorage.setItem("name", "学生管理/学生信息查询");
      $(function () {
        openMsg();
        $("#search").on("click", function () {
          $("#table").bootstrapTable("refresh");
        });
        var perm = JSON.parse(localStorage.getItem("userInfo")).perm;
        $("#table").bootstrapTable({
          method: "get",
          striped: true,
          singleSelect: false,
          url: baseUrl + "studentInfo/getStudentList",
          // url: baseUrl + 'studentInfo/getStudentAllInfo',
          dataType: "json",
          // rowStyle:rowStyle,
          pagination: true, //分页
          sidePagination: "server",
          pageSize: 10,
          pageNumber: 1,
          search: false, //显示搜索框
          contentType: "application/x-www-form-urlencoded",
          ajaxOptions: {
            headers: {
              Authorization: JSON.parse(localStorage.getItem("userInfo")).token,
            },
          },
          queryParams: function (params) {
            params.trainType = $("#type").val();
            params.commitFlag = $("#status").val();
            params.name = $("#name").val();
            params.idNo = $("#card").val();
            var perm = JSON.parse(localStorage.getItem("userInfo")).perm;
            if (perm == 1) {
              params.userType = "guanli";
            } else {
              params.userType = "teacher";
            }
            // params.mobile = $('#phone').val()
            params.businessProgress = $("#businessProgress").val();
            perm != 1 && (params.userType = "teacher");
            params.offset = params.offset / params.limit;
            delete params.order;
            return params;
          },
          responseHandler: function (res) {
            var list = res.data.result.records;
            var maps = {
              education: "学历提升",
              occupation: "职业技能",
              title: "职称评审",
              train: "执业资格",
            };
            list.forEach(function (item, i) {
              item.trainTypeName = maps[item.trainType];
              !item && (list[i] = {});
            });
            return {
              rows: list,
              total: res.data.total,
            };
          },
          columns: [
            {
              field: "no",
              title: "序号",
              sortable: true,
              align: "center",
              formatter: function (value, row, index) {
                var pageSize =
                  $("#table").bootstrapTable("getOptions").pageSize;
                var pageNumber =
                  $("#table").bootstrapTable("getOptions").pageNumber;
                return pageSize * (pageNumber - 1) + index + 1;
              },
            },
            {
              title: "学生姓名",
              field: "name",
              align: "center",
              valign: "middle",
            },
            {
              title: "身份证号",
              field: "idNo",
              align: "center",
            },
            {
              title: "招生老师手机号",
              field: "teacherMobile",
              align: "center",
            },
            {
              title: "报考类型",
              field: "trainTypeName",
              align: "center",
            },
            {
              title: "报考进度",
              field: "submissionFlag",
              align: "center",
              formatter: function (value, row, index) {
                const map = { 0: "未报考", 1: "已报考" };
                return map[row.submissionFlag];
              },
            },
            {
              title: "证书",
              field: "receiveFlag",
              align: "center",
              formatter: function (value, row, index) {
                const map = { 0: "未领取", 1: "已领取" };
                return map[row.receiveFlag];
              },
            },
            {
              title: "审核状态",
              field: "commitStr",
              align: "center",
            },
            {
              title: "业务进度",
              field: "businessProgress",
              align: "center",
              formatter: function (value, row) {
                console.log(row.businessProgress);
                if (row.businessProgress === 0) {
                  return "报考";
                } else if (row.businessProgress === 1) {
                  return "退款";
                } else if (row.businessProgress === 2) {
                  return "分期缴费";
                }
              },
            },
            {
              title: "操作",
              field: "id",
              align: "center",
              width: "200",
              formatter: function (value, row) {
                var a =
                  '<a href="#" style="margin-left:8px" onclick="refund(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.colorFlag +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">退款</a> ";

                var e =
                  '<a href="#" onclick="look(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.colorFlag +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">资料补录</a> ";

                var d =
                  '<a href="#" style="margin-left:8px" onclick="edit(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.colorFlag +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">修改</a> ";

                var c =
                  '<a href="#" style="margin-left:8px" onclick="baokaoEdit(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.colorFlag +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">修改</a> ";

                var b =
                  '<a href="#" style="margin-left:8px" onclick="tuikuanEdit(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.colorFlag +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">修改</a> ";

                var f =
                  '<a href="#" style="margin-left:8px" onclick="upload(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "', '" +
                  row.commitFlag +
                  "')\">凭证上传</a> ";

                var g =
                  '<a href="#" style="margin-left:8px" onclick="print(\'' +
                  row.idNo +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">打印</a> ";

                var h =
                  '<a href="#" style="margin-left:8px" onclick="zuofei(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.colorFlag +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">作废</a> ";

                var i =
                  '<a href="#" onclick="lookPrint(\'' +
                  row.id +
                  "', '" +
                  row.idNo +
                  "', '" +
                  row.colorFlag +
                  "', '" +
                  row.trainType +
                  "', '" +
                  row.studyId +
                  "')\">查看</a> ";

                var optionStr = e;

                return optionStr;
              },
            },
          ],
        });
      });

      function upload(id, idNo, trainType, studyId, commitFlag) {
        window.location.href =
          "./upload.html?from=student&id=" +
          id +
          "&idNo=" +
          idNo +
          "&trainType=" +
          trainType +
          "&studyId=" +
          studyId +
          "&commitFlag=" +
          commitFlag;
      }

      // function refund(id, idNo, flag, trainType, studyId) {
      //     window.location.href = './student-refund.html?type=tuikuan&from=student&id=' + id + '&idNo=' + idNo + '&flag=' + flag + '&trainType=' + trainType + '&studyId=' + studyId
      // }

      function refund(id, idNo, flag, trainType, studyId) {
        window.location.href =
          "../student/refund.html?type=tuikuan&from=student&id=" +
          id +
          "&idNo=" +
          idNo +
          "&flag=" +
          flag +
          "&trainType=" +
          trainType +
          "&studyId=" +
          studyId;
      }

      function edit(id, idNo, flag, trainType, studyId) {
        // window.location.href = './student_edit.html?type=edit&from=list&id=' + id + '&idNo=' + idNo + '&flag=' + flag + '&trainType=' + trainType + '&studyId=' + studyId

        window.location.href =
          "../student/edit.html?type=edit&from=bc&id=" +
          id +
          "&idNo=" +
          idNo +
          "&flag=" +
          flag +
          "&trainType=" +
          trainType +
          "&studyId=" +
          studyId;
      }

      function baokaoEdit(id, idNo, flag, trainType, studyId) {
        window.location.href =
          "../student/edit.html?type=edit&from=student&id=" +
          id +
          "&idNo=" +
          idNo +
          "&flag=" +
          flag +
          "&trainType=" +
          trainType +
          "&studyId=" +
          studyId;
      }

      // function baokaoEdit(id, idNo, flag, trainType, studyId) {
      //     window.location.href = './student_edit.html?type=baokao&from=list&id=' + id + '&idNo=' + idNo + '&flag=' + flag + '&trainType=' + trainType + '&studyId=' + studyId
      // }

      function tuikuanEdit(id, idNo, flag, trainType, studyId) {
        // window.location.href = './tuikuan-edit.html?type=edit&from=list&id=' + id + '&idNo=' + idNo + '&flag=' + flag + '&trainType=' + trainType + '&studyId=' + studyId

        window.location.href =
          "../student/edit.html?type=edit&from=student&id=" +
          id +
          "&idNo=" +
          idNo +
          "&flag=" +
          flag +
          "&trainType=" +
          trainType +
          "&studyId=" +
          studyId;
      }

      // function fenqiEdit(id, idNo, flag, trainType, studyId) {
      //     window.location.href = './fenqi-edit.html?type=edit&from=list&id=' + id + '&idNo=' + idNo + '&flag=' + flag + '&trainType=' + trainType + '&studyId=' + studyId
      // }

      function look(id, idNo, flag, trainType, studyId) {
        // old
        // window.location.href = './all-look.html?type=look&from=student&id=' + id + '&idNo=' + idNo + '&flag=' + flag + '&trainType=' + trainType + '&studyId=' + studyId

        window.location.href =
          "../student/student-supplement.html?type=look&from=student&id=" +
          id +
          "&idNo=" +
          idNo +
          "&flag=" +
          flag +
          "&trainType=" +
          trainType +
          "&studyId=" +
          studyId;
      }

      function lookPrint(id, idNo, flag, trainType, studyId) {
        // old
        // window.location.href = './all-look.html?type=look&from=student&id=' + id + '&idNo=' + idNo + '&flag=' + flag + '&trainType=' + trainType + '&studyId=' + studyId

        window.location.href =
          "../student/edit.html?type=look&from=student&action=print&id=" +
          id +
          "&idNo=" +
          idNo +
          "&flag=" +
          flag +
          "&trainType=" +
          trainType +
          "&studyId=" +
          studyId;
      }

      function zuofei(id, idNo, flag, trainType, studyId) {
        layer.open({
          type: 0,
          offset: "t",
          title: "提示",
          content: "是否要作废？",
          btn: ["是", "否"],
          yes: function (index) {
            layer.close(index);
            $.ajax({
              url: baseUrl + "studentInfo/makeVoid",
              method: "Post",
              headers: {
                Authorization: JSON.parse(localStorage.getItem("userInfo"))
                  .token,
              },
              data: {
                studyId,
              },
              success: function (data) {
                $("#table").bootstrapTable("refresh");
                alert(data == "1" ? "作废成功" : "作废失败");
              },
            });
          },
        });
      }

      function print(idNo, trainType, studyId) {
        // 学历提升
        if (trainType === "education") {
          window.open(
            "./education_pdf.html?type=look&from=student&idNo=" +
              idNo +
              "&trainType=" +
              trainType +
              "&studyId=" +
              studyId
          );
        } else if (trainType === "occupation") {
          // 职业技能
          window.open(
            "./occupation_pdf.html?type=look&from=student&idNo=" +
              idNo +
              "&trainType=" +
              trainType +
              "&studyId=" +
              studyId
          );
        } else if (trainType === "title") {
          // 职称评审
          window.open(
            "./title_pdf.html?type=look&from=student&idNo=" +
              idNo +
              "&trainType=" +
              trainType +
              "&studyId=" +
              studyId
          );
        } else if (trainType === "train") {
          // 执业资格
          window.open(
            "./train_pdf.html?type=look&from=student&idNo=" +
              idNo +
              "&trainType=" +
              trainType +
              "&studyId=" +
              studyId
          );
        }
      }

      // function rowStyle(item, index) {
      //     style = item.colorFlag == 1 ? {css:{'color':'#ed5565'}} : {}
      //     return style;
      // }
    </script>
  </body>
</html>
